// pages/lose/lose.js
let app = getApp();
Page({

  /**
	 * 页面的初始数据
	 */
  data: {
    money: '',
    imgPath: app.globalData.imgPath
  },

  /**
	 * 生命周期函数--监听页面加载
	 */
  onLoad: function(options) {
    if (options.money) {
      this.setData({
        money: options.money
      });
    }
  },

  /**
	 * 生命周期函数--监听页面初次渲染完成
	 */
  onReady: function() {

  },

  /**
	 * 生命周期函数--监听页面显示
	 */
  onShow: function() {

  },

  /**
	 * 生命周期函数--监听页面隐藏
	 */
  onHide: function() {

  },

  /**
	 * 生命周期函数--监听页面卸载
	 */
  onUnload: function() {
    wxfaceapp.postMsg({
      targetAppid: app.data.accept_message_id,
      content: JSON.stringify({
        bolshow: false,
        moneyBol: true
      }),
      success(res) {

      },
      fail(res) {
        wx.showToast({
          title: res.reply,
          icon: 'none',
          duration: 2000
        });
      }
    });
  },

  /**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
  onPullDownRefresh: function() {

  },

  /**
	 * 页面上拉触底事件的处理函数
	 */
  onReachBottom: function() {

  },

  /**
	 * 用户点击右上角分享
	 */
  onShareAppMessage: function() {

  },
  cancelBtn() {
    wx.redirectTo({
      url: '/packageC/frogpro/storeManagement/storeManagement'
    });
  },
  attemptBtn() {
    let that = this;
    if (that.data.money) {
      let Json = {
        bolshow: true,
        money: that.data.money,
        moneyBol: true
      };
      wxfaceapp.postMsg({
        targetAppid: app.data.accept_message_id,
        content: JSON.stringify(Json),
        success(res) {},
        fail(res) {
          wx.showToast({
            title: res.reply,
            icon: 'none',
            duration: 2000
          });
        }
      });
    } else {
      wx.redirectTo({
        url: '/packageC/frogpro/backScreenlogin/backScreenlogin'
      });
    }
  }
});
